/**
 * COPYRIGHT HangZhou Trustway Technology Company Limited
 * All right reserved.
 */
package com.robam.cloud.apicenter.service.impl;

import com.robam.cloud.apicenter.dao.SysConfigMapper;
import com.robam.cloud.apicenter.service.SysConfigService;
import com.robam.cloud.cache.annotation.CacheExpire;
import com.robam.cloud.common.bean.apicenter.entity.SysConfigWithBLOBs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description
 * @Author 薛铁琪
 * @CreateTime 2020-07-23 15:06
 * @Version 1.0
 */
@Service
public class SysConfigServiceImpl implements SysConfigService {
    @Autowired
    SysConfigMapper sysConfigMapper;

    @Override
    @CacheExpire(expire = 3600)
    @Cacheable(value = "API-CENTER", key = "'SysConfig_'+'csdm_' + #csdm", unless = "#result == null")
    public SysConfigWithBLOBs getSysConfigByCsdm(String csdm) {
        return sysConfigMapper.selectByCsdm(csdm);
    }

    @Override
    public List<SysConfigWithBLOBs> getAllSysConfig() {
        return sysConfigMapper.selectAll();
    }
}
